<?php
	include("../Action/config.php");
	
	$json = urldecode(file_get_contents("php://input"));
	$arrayJson = json_decode($json,true);
	$id = $arrayJson['id'];
	$password = $arrayJson['password'];
	
	$sql = "SELECT * FROM PARENT WHERE parent_id='$id'";
	$result = mysql_query($sql);
	$row = mysql_fetch_array($result);
	$db_password = $row['password'];
	$salt = $row['salt'];		
	$parent_num = $row['parent_num'];
	
	//$hashed_password = crypt($password, $Blowfish_Pre . $salt . $Blowfish_End);  
	$count = mysql_num_rows($result);
	
	if($count==1 && $password==$db_password){
		echo $parent_num;
	}else{
		echo "fail";
	}
	
	// if($count==1 && $hashed_password==$db_password){
		// echo $parent_num;
	// }else{
		// echo "fail";
	// }
?>


